package ui.custom.table;

import java.util.List;

import javax.swing.table.DefaultTableModel;

import domain.valueObejcts.Employee;
import domain.valueObejcts.Project;

public class MyPersonModel extends DefaultTableModel {

	private static final long serialVersionUID = 1L;

	private Project project;

	private List<Employee> employees;
	
	public MyPersonModel(String[][] persons, String[] columns, Project project, List<Employee> employees) {
		super(persons, columns);
		this.project = project;
		this.employees = employees;
	}
	
	@Override
	public Object getValueAt(int row, int column) {
		Employee employee = employees.get(row);
		switch (column) {
		case 0:
			return employee.getForName() + ", " + employee.getSurName().charAt(0) + ".";
		case 1:
			return employee.isSmoker() ? "Ja" : "Nein";
		case 2: 
			return project.getShifts(employee);
		case 3:
			return project.getWorked(employee);
		case 4:
			return project.getPlaned(employee);
		case -1:
			return employee.getId();
		default:
			break;
		}
		return null;
	}
	
	@Override
	public boolean isCellEditable(int arg0, int arg1) {
		return false;
	}

}
